<!DOCTYPE html>
<html>
<head lang="en">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/>
    <meta name = "format-detection" content="telephone = no" />
    <meta charset="UTF-8">
    <title></title>
</head>
<body>

<form action="https://www.pulu.com/webapi/api/puluuser/GetUserProc" name="login_form" method="post" target="showTEXT">
    First Id:<br>
    <input type="text" name="loginuserId">
    <br>
    Last Id:<br>
    <input type="text" name="userId">
    <br><br>
    <input type="submit" value="Submit">
</form>
<iframe id="showTEXT" name="showTEXT"></iframe>

<script src="https://www.pulu.com/weixin/js/jquery-1.11.3.min.js"></script>
<script src="https://www.pulu.com/weixin/ftnjs/urlnote.js"></script>
<script>
    function setOnloadCallBask(obj, event, handler) {
        //for most explores
        if (null != obj && null != obj.addEventListener) {
            obj.addEventListener(event, handler, false);
        }
        //for IE
        else if (null != obj && null != obj.attachEvent) {
            obj.attachEvent('on'+event, handler);
        }
        //not support
        else {
            //选择dom元素错误
            throw new Error('不支持该dom元素');
        }
    };

    $(document).ready(function()  {
        //注意这里最好在文档加载完成的时候再获取元素，否则可能获取到的一直是null
        setOnloadCallBask(document.getElementById("showTEXT"),'load',ActionHandler);
    });

    function ActionHandler()  {
        //alert("call");
        //文档加载或刷新时也会调用，因此需要通过标志位控制，提交时将标志位置为1，在这里处理之后修改标志位为0
//        if(0 != handlerFlag)  {
            //do action
            var value = document.getElementById("showTEXT").contentWindow.document.body.innerHTML;
            if(null!=value)  {
                console.log(value);
                var obj = eval("("+value+")");
                if(obj.result=="ok")  {
                    top.document.location.href="resource.shtml";
                }
                else {
                    window.parent.doNotice(obj.message);
                }
            }
            //update flag.
//            handlerFlag = 0;
//        }
    }



    //    var formData = new FormData(document.forms.namedItem("login_form"));
//    console.log(formData);
//    var value = document.getElementById("showTEXT").contentWindow.document.body.innerHTML;
</script>
</body>
</html>